<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>怎么就是FC不了，怎么又是那个熟悉的nice</title>

<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Advent+Pro:100);
#overlay {
    font-family: 'Advent Pro', sans-serif;
	font-size: 7em;
	color: rgba(255, 255, 255, 1);
	z-index: 10;
	margin: .2em .5em;
	position: fixed; 
	left: 100; 
	top: 0;
}
video#bgvid { 
	position: fixed; 
	left: 100; 
	top: 0;
	width: auto; 
	height: 600; 
	z-index: 5;

}
div#tmp{
    background-size: cover;
	background-image: url("http://i.imgur.com/9FagndK.jpg");
    
}

div#text {
	position: fixed; 
	left: 0; 
	top: 0;
	z-index: 1;
}
</style>

<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
	//全域變數
	time = new Date();
    gginin=[];ggobj={};
	//
    gginin.index=[];
	gginin.index[0]="1.txt";
	gginin.video=[];
	gginin.video[0]='index/a001--LgFb_pTF8iVeFNYd.mp4';
	gginin.video[1]='index/a002--bUseY743xyh9g83F.mp4';
	gginin.video[2]='index/a003--lwYb7ePKCEdMegsk.mp4';
	gginin.cc=[];
	gginin.cc[0]=0;
	//gginin.video[0]='xxxxxxxx';
	ggobj.url={};
    //
    //console.log(gginin);
	//console.log(ggobj);
    //
    loadDoc();
	//poi();
	videoListener();//
});

function videoListener(){
    var video = document.getElementById('bgvid');
	video.setAttribute("src", "");//
	video.setAttribute("preload", "metadata");//
    
    document.getElementById('bgvid').addEventListener('ended', function(e){
		//console.log("video end1");
		gginin.cc[0]++;
		if(typeof gginin.video[gginin.cc[0]] != "undefined"){
			videoPlaylist();
		}else{
			gginin.cc[0]=0;
			videoPlaylist();
		}
	});
    //
    videoPlaylist();
    //
}

function videoPlaylist(){
    //console.log("video playlist");
	var video = document.getElementById('bgvid');
    video.setAttribute('src', gginin.video[gginin.cc[0]] );//
	//console.log(video.src);
	video.play();
	//
	//console.log("cc="+gginin.cc[0]);
}








function loadDoc() {
    var xhttp = new XMLHttpRequest();
	xhttp.onreadystatechange = function() {
    	if (this.readyState == 4 && this.status == 200) {
			document.getElementById("ddd").innerHTML = this.responseText;
			poi2();
		}else{
			document.getElementById("ddd").innerHTML = this.status;
		}
	};
	xhttp.open("GET", gginin.index[0]);
	xhttp.send();
}

function poi2(){
    
	$("#ddd").html("");// (inner HTML)。
	
	var request=$.ajax({
    	url: gginin.index[0],
    	type: "GET",
    	contentType: "text/plain",
    	dataType:"text",
    	async: true,
	})
	.done(function(data, textStatus, jqXHR) {
	//alert( "success" );
		var str=tmp='';
		//alert(data);//原始資料
		data = data.split("\r").join("");
		//data.replace(/\r/g, "");//失敗
		str = data.split("\n");//切割
		//alert(str.length);//陣列長度
		for(i=0;i<str.length;i++){
			//document.getElementById("ddd").innerHTML="沒了";
			//data=decodeURIComponent(data);
			//query=encodeURIComponent(query);
			//str[i]=str[i].trim();
			if(str[i].trim().length>0){//
				tmp='./'+encodeURIComponent(str[i]);
				$("#ddd").append('<a href="'+tmp+'">'+tmp+'</a><br/>');
			}
			
		}
	})
	.fail(function(jqXHR, textStatus, errorThrown) {
	//alert( "error" );
	})
	.always(function(data, textStatus, jqXHR) {
	//alert( "complete" );
	});
}




function poi(){
	$.get('1.txt', function(data) { //讀取文字檔
		var str=tmp='';
		//alert(data);//原始資料
        //console.log(data);
        //console.log(data.match(/\r/g).length);
        //console.log(data.match(/\n/g).length);
        
        //data=encodeURIComponent(data);
        //data.replace(/%0D/g, "rrr");//  /\r/g
        //data.replace(/\\r/g, "ppp");//  /\r/g
        //data=decodeURIComponent(data);
        //data.replace(/(\r\n|\r|\n)/gm, "nnn");
        data = data.split("\r").join("");
        //console.log(data);

        str = data.split("\n");//切割
        //console.log(str);
		//alert(str.length);//陣列長度
		for(i=0;i<str.length;i++){
			//document.getElementById("ddd").innerHTML="沒了";
			//query=encodeURIComponent(query);
            //str[i]=str[i].trim();
            //console.log("c"+str[i].length);
			if(str[i].trim().length>0){
				tmp='./'+encodeURIComponent(str[i]);
				$("#ddd").append('<a href="'+tmp+'">'+tmp+'</a><br/>');
			}
			
		}
	});
	//
	myVid=document.getElementById("bgvid");
	myVid.volume=0.41;//一半的音量
}
</script>
</head> 
<body>

<video controls id="bgvid">
您的浏览器不支持 video 标签。

</video>

<div id="overlay">#illyadance</div>
<div id="ddd"></div>
</body></html>